package org.csu.mypetstore.persistence;

import org.apache.ibatis.annotations.Select;
import org.csu.mypetstore.domain.Category;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CategoryMapper {
    //select all Category
    @Select("        SELECT\n" +
            "            CATID AS categoryId,\n" +
            "            NAME,\n" +
            "            DESCN AS description\n" +
            "        FROM CATEGORY")
    List<Category> getCategoryList();
    //select a Category By a Id

    @Select("        SELECT\n" +
            "            CATID AS categoryId,\n" +
            "            NAME,\n" +
            "            DESCN AS description\n" +
            "        FROM CATEGORY\n" +
            "        WHERE CATID = #{categoryId}")
    Category getCategory(String categoryId);
}
